<?php
/**
 * NAME: bwstatus
 * WHEN: OnMsg
 * PROVIDES: !bwstatus
 * AUTOLOAD: false
 * DESCRIPTION: Wyświetla status serwera bloodworld.
 * VERSION: 0.1
 * UPDATE: http://update.tempaq2.blacksoft.eu/check.php
 * AUTHOR: blacksoft.eu
 */
 
exit();

//*function_start
if ($d[0]=='!bwstatus') {
	
	if (!($da=@file_get_contents('http://wow.bloodworld.eu:666/realmone.php'))) {
		$error = true;
	}

	$parsestring1="/\<img alt=Online src=\'img\/online\.gif\' height=\'18\' width=\'18\'\>\&nbsp;Bloodworld\.eu BlizzLike \(([0-9]+) graczy online\)\<\/center\>/";
	//$parsestring2="/\<font color=red\> \<b\>([0-9]+)\<\/b\> \<\/font\>/";
	
	if (preg_match_all($parsestring1,$da,$wyniki1)) $online = true;
	//preg_match_all($parsestring2,$d,$wyniki2);
	
	$online_players=$wyniki1[1][0];
	//$online_gm=$wyniki2[1][0];
	
	unset($da);
	unset($parsestring1);
	//unset($parsestring2);
	unset($wyniki1);
	//unset($wyniki2);
	
	if ($online)
		$msg=$lang->text('online', $online_players);
	else if (!$error) {
		$msg=$lang->text('offline');
	} else $msg = $lang->text('error');
	
	$this->send($msg);
	
	unset ($online_players, $online);
//	unset ($online_gm);
}

//*function_end	
?>